<template>
  <div>
    <h2>登陆页面</h2>
    <table class="table tableb-bordered">
      <tr>
        <td>用户名</td>
        <td>
          <input type="text" v-model="info.dname">
        </td>
      </tr>
      <tr>
        <td>密码</td>
        <td>
          <input type="password" v-model="info.dpwd">
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <input type="button" value="登录" @click="login">
        </td>
  
      </tr>
    </table>

  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
const info=ref({
  dname:"",
  dpwd:"",
})

//登陆函数
const login=()=>{
  if(info.value.dname==""||info.value.dpwd=="")
  {
    alert("用户名和密码不能为空");
    return;
  }
  if(info.value.dname=="admin"||info.value.dpwd=="admin")
  {
    alert("登陆成功");
  }
  else {
    alert("登陆失败");
  }

}
</script>

<style scoped>

</style>